import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import Login from '@/views/login/Login.tsx'
import Layout from '@/layout/Layout.tsx'
import Index from '@/views/index/Index'
import Article from '@/views/article/Article.tsx'
import ArticleDetail from '@/views/article/ArticleDetail.tsx'

function App() {
  return (
    <Router>
      <Routes>
        {/* 登录页单独存在，不受 Layout 影响 */}
        <Route path="/login" element={<Login />} />

        {/* 这里是 Layout 作为父级的嵌套路由 */}
        <Route path="/" element={<Layout />}>
          <Route index element={<Index />} /> {/* 默认首页 */}
          <Route path="/article" element={<Article />} />
          <Route path="/article-detail/:id" element={<ArticleDetail />} />
        </Route>
      </Routes>
    </Router>
  )
}

export default App
